package org.tigr.htc.server;

/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

import org.tigr.htc.cmd.Command;

/**
 * The <b>IJobMonitor</b> interface - defines the interface that should be implemented
 * by classes that monitor the grid for job status.
 */
public interface IJobMonitor extends Runnable {
	
	/** 
	 * The method <code>setActive</code> sets the value for active. If the flag is set to
	 * false, the monitor stops monitoring the status.
	 * 
	 * @param active A <code>boolean</code> value for the field active.
	 */
	public void setActive(boolean active);
	
	/**
	 * The method <code>register</code> registers the job with the specified ID to list
	 * of jobs being monitored by this job monitor.
	 * 
	 * @param jobID a <code>String</code> representing the jobID
	 * @param cmd a <code>String</code> representing the jobID
	 */
	public void register(String jobID, Command cmd);

    /**
     * The method <code>stop</code> removes the job that corresponds to the command from 
     * the grid.
     * 
     * @param cmd a <code>Command</code> which has been submitted to the grid
     * 
     * @return a <code>boolean</code> value of true if the job could be removed 
     * successfully, false otherwise
     * 
     * @throws Exception
     */
    public boolean stop(Command cmd) throws Exception;

    /**
     * The method <code>hold</code> puts the job that corresponds to the command on hold 
     * 
     * @param cmd a <code>Command</code> which has been submitted to the grid
     * 
     * @return a <code>boolean</code> value of true if the job could be put on hold
     * successfully, false otherwise
     * 
     * @throws Exception
     */
    public boolean hold(Command cmd) throws Exception;

    /**
     * The method <code>resume</code> releases the hold on the job that corresponds to 
     * the command.
     * 
     * @param cmd a <code>Command</code> which has been held on the grid
     * 
     * @return a <code>boolean</code> value of true if the hold on the job could be 
     * released successfully, false otherwise
     * 
     * @throws Exception
     */
    public boolean resume(Command cmd) throws Exception;
}